# coding=utf-8
import os


def run(image, port, *vars):
    '''
    :param image: 传入一个镜像名称
    :return:
    '''
    cmd_add = {}
    for var in vars:
        for s in var:
            cmd_add.update({s: var[s]})
    cmd = ''
    for name, vars in cmd_add.items():
        cmd = cmd + (f' {name} {vars} ')
    c = (f'docker run -tid -p {port}:80 {cmd} {image} bash')
    print(f'创建命令: [ {c} ]')
    # os.system(cmd)


run('wordpress', 80, {'-p': '443:443'}, {'--link': 'db:mysql'})
